﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;

using Parafarmacia;
using Data.Models;

namespace Parafarmacia
{
    public class Global : HttpApplication
    {

        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            //AuthConfig.RegisterOpenAuth();

            dbParafarmaciaContext db = new Data.Models.dbParafarmaciaContext();
            db.Database.CreateIfNotExists();

            //Data.Models.DatabaseInitializer dbini = new DatabaseInitializer();
            //dbini.InitializeDatabase(new Data.Models.dbParafarmaciaContext());

            RegisterRoutes(RouteTable.Routes);

        }

        void RegisterRoutes(RouteCollection routes)
        {
            routes.MapPageRoute("ProductDetailRoute", "Producto/{Id}", "~/ProductDetail.aspx");
            routes.MapPageRoute("ProductsRoute", "Productos", "~/Products.aspx");
            routes.MapPageRoute("ServicesRoute", "Servicios", "~/Services.aspx");
            routes.MapPageRoute("AdvisementRoute", "Asesoramiento", "~/advisement.aspx");
            routes.MapPageRoute("ContactoRoute", "Contacto", "~/Contact.aspx");

        }

        public static void setSessionID()
        {

        }

        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

        }

        void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs
        }
    }
}
